﻿using MetroDataApi.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace MetroDataApi.Controllers
{
    public class AllProjectsController : ApiController
    {
        // GET api/allprojects
        public string Get()
        {
            using (var db = new MetroDataDataContext())
            {
                var list = (from p in db.Projects orderby p.LineId select p).ToList();
                string ignored = JsonConvert.SerializeObject(list,
  Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
                return ignored;
            }
        }

        // GET api/allprojects/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/allprojects
        public void Post([FromBody]string value)
        {
        }

        // PUT api/allprojects/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/allprojects/5
        public void Delete(int id)
        {
        }
    }
}
